<template>
  <div>
    <FormPanel ref="from" :list="formList" @formChange="changeHandle" :isSubmitBtn="false" :collapse="false" labelWidth="110" />
    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onRowSelectChange="selectChangeHandle"
      :onColumnsChange="columns => this.columns = columns"
    >

    </FilterTable>

    <BreakSpace label='操作记录' />
    <FilterTable
      ref="table"
      :columns="columns1"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onRowSelectChange="selectChangeHandle"
      :onColumnsChange="columns => this.columns1 = columns"
    >

    </FilterTable>
    <div style="height:47px;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>

    </div>
  </div>
</template>
<script>
import AccountProject from './AccountProject'
import contract from './contract'
import selectCar from './selectCar'
import ownerSeacher from './ownerSeacher'
export default {
  data(){
    return{
      formList:this.createdFrom(),
      columns:this.createdTable(),
      columns1:this.createdTables(),
      fetchParams:{

      },
      fetchApi:()=>{},
      isaddCar:false,
      iscontract:false,
      isProject:false,
      isDiscount:false,
      isowner:false,
    }
  },
  components: {
    AccountProject,
    contract,
    selectCar,
    ownerSeacher
  },
  methods:{
    createdFrom(){
      return [
        {
          type: 'BREAK_SPACE',
          label: '大客户订单信息',

        },
        {
          type: 'INPUT',
          label: '合同名称',
          fieldName: 'htmc',
          placeholder: '请选择',
          readonly:true,
          disabled:true,
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={() => this.seacherFun(1)}></el-button>
              </div>
            );
          },
          rules: [{ required: true, message: '请选择', trigger: 'blur' }],
        },
        {
          type: 'INPUT',
          label: '大客户项目名称',
          fieldName: 'dkhxmmc',
          placeholder: '请选择',
          readonly:true,
          disabled:true,
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={() => this.seacherFun(2)}></el-button>
              </div>
            );
          },
          rules: [{ required: true, message: '请选择', trigger: 'blur' }],
        },
        {
          type: 'INPUT',
          label: '大客户名称',
          fieldName: 'dkhmc',
          placeholder: '请输入',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '大客户订单编号',
          fieldName: 'dkhddbh',
          placeholder: '请输入',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '选择经销商',
          fieldName: 'xzjxs',
          placeholder: '请选择',
          disabled:true,
          readonly:true,
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={() => this.seacherFun(3)}></el-button>
              </div>
            );
          },
        },
        {
          type: 'SELECT',
          label: '订单类型',
          fieldName: 'jxsmc',
          placeholder: '请选择',
          disabled:true,
          itemList:[],
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
        },
        {
          type: 'SELECT',
          label: '订单细分类型',
          fieldName: 'jxsmc',
          placeholder: '请选择',
          disabled:true,
          itemList:[],
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
        },
        {
          type: 'SELECT',
          label: '运输方式',
          fieldName: 'ysfs',
          placeholder: '请选择',
          disabled:true,
          itemList:[],
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
        },
        {
          type: 'SELECT',
          label: '是否使用返利',
          fieldName: 'sfsyfl',
          placeholder: '请选择',
          disabled:true,
          itemList:[],
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
        },
        {
          type: 'INPUT',
          label: '资金总余额',
          fieldName: 'zjzye',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '返利池余额',
          fieldName: 'flcye',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '返利使用总余额',
          fieldName: 'flsyzje',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '单车返利总余额',
          fieldName: 'dcflzje',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'INPUT',
          label: '建店返利总余额',
          fieldName: 'jdflzje',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'DATE',
          label: '要求交付日期',
          fieldName: 'yqjfrq',
          placeholder: '请选择',
          disabled:true,
        },
        {
          type: 'SELECT',
          label: '开票类型',
          fieldName: 'kplx',
          placeholder: '请选择',
          disabled:true,
          itemList:[],
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
        },
        {
          type: 'INPUT',
          label: '实付总金额',
          fieldName: 'sfzje',
          disabled:true,
        },
        {
          type: 'SELECT',
          label: '资金类型',
          fieldName: 'zjlx',
          placeholder: '请选择',
          disabled:true,
          itemList:[]
        },
        {
          type: 'BREAK_SPACE',
          label: '车辆信息',

        },
      ]
    },
    createdTable(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },

        {
          title: '收车地址',
          dataIndex: 'scdz',
          sorter: true,
          filter: true,
          filterType: 'input',

        },
        {
          title: '产品代码',
          dataIndex: 'zcbm',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '产品名称',
          dataIndex: 'zcbmms',
          align: 'center',
          width: 400,
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '车型名称',
          dataIndex: 'cxmc',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '内饰',
          dataIndex: 'ns',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '外饰',
          dataIndex: 'ws',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '数量',
          dataIndex: 'sl',
          sorter: true,
          filter: true,
          filterType: 'input',

        },
        {
          title: '合同数量',
          dataIndex: 'htsl',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '剩余数量',
          dataIndex: 'sysl',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '市场指导价',
          dataIndex: 'sczdj',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '国补金额',
          dataIndex: 'gbje',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '折扣总金额',
          dataIndex: 'zkzje',
          sorter: true,
          filter: true,
          filterType: 'input',
          summation:true,
        },
        {
          title: '使用返利总金额',
          dataIndex: 'syflzje',
          sorter: true,
          filter: true,
          filterType: 'input',
          summation:true,
        },
        {
          title: '单车返利总金额',
          dataIndex: 'dcflzje',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '建店返利总金额',
          dataIndex: 'jdflzje',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '折后单价',
          dataIndex: 'zhdj',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '折前总金额',
          dataIndex: 'zqzje',
          sorter: true,
          filter: true,
          filterType: 'input',
          summation:true,
        },
        {
          title: '折后总金额',
          dataIndex: 'zhzje',
          sorter: true,
          filter: true,
          filterType: 'input',
          summation:true,
        },
        {
          title: '备注',
          dataIndex: 'remark',
          sorter: true,
          filter: true,
          filterType: 'input',
        },

      ]
    },
    createdTables(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '单据执行前状态',
          dataIndex: 'djzxqzt',
          sorter: true,
          filter: true,
          filterType: 'input',

        },
        {
          title: '单独执行后状态',
          dataIndex: 'ddzxhzt',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '操作人员',
          dataIndex: 'czry',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '操作时间',
          dataIndex: 'czsj',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '操作类型',
          dataIndex: 'czlx',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '审批意见',
          dataIndex: 'spyj',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
      ]
    },
    // 新增车辆
    addHandle(){
      this.isaddCar=true
    },
    seacherFun(type){
      if(type==1){
        this.iscontract=true;
      }else if(type==2){
        this.isProject=true;
      }else{
        this.isowner=true;
      }
    },
    changeHandle(val){

    },
    closeDrawer(type){

    },
    async editHandle(data,type){
      if(type==1){
        await this.$confirm('是否确定删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(async () => {

      })
      .catch(()=>{})
      }else{
        this.isDiscount=true;
      }
    }
  }
}
</script>
